package com.ccsoft.atools.controller;

import com.ccsoft.atools.model.LifeSchedule;
import com.ccsoft.atools.service.LifeScheduleService;
import com.ccsoft.atools.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName:LifeScheduleController
 * @Description:TODO
 * @Author:chanchaw
 * @Date:2020-01-13 21:09
 * @Version:1.0
 **/

@CrossOrigin
@RestController
@RequestMapping("/lifeSchedule")
public class LifeScheduleController {

    @Autowired
    private LifeScheduleService service;

    @DeleteMapping("/{iid}")
    public JsonResult deleteByPrimaryKey(@PathVariable java.lang.Integer iid) {
        return JsonResult.ok(service.deleteByPrimaryKey(iid));
    }

    @GetMapping("/selectByPrimaryKey/{iid}")
    public JsonResult selectByPrimaryKey(@PathVariable java.lang.Integer iid) {
        return JsonResult.ok(service.selectByPrimaryKey(iid));
    }

    @GetMapping("/selectAll")
    public JsonResult selectAll() {
        return JsonResult.ok(service.selectAll());
    }

    @PostMapping("/insert")
    public JsonResult insert(@RequestBody LifeSchedule record) {
        LifeSchedule ret = service.insertSelective(record);
        return JsonResult.ok(ret);
    }

    @PutMapping("/update")
    public JsonResult update(@RequestBody LifeSchedule record) {
        return JsonResult.ok(service.updateByPrimaryKey(record));
    }


}